import { Roles } from "..";
import RolesStore from "@/stores/modules/RolesStore";
const store = RolesStore();

export async function Add(data) {
    try {
        await Roles.Add(data);
    } catch (error) {
        console.log(error);
    }
}

export async function Info() {
    try {
        const res = await Roles.Info();
        const info = res.data.data;
        await store.Info(info);
    } catch (error) {
        console.log(error);
    }
}

export async function SearchRolesInfo(data) {
    try {
        const res = await Roles.Search(data);
        const info = res.data.data;
        await store.Info(info);
    } catch (error) {
        console.log(error);
    }
}

export async function Update(data) {
    try {
        const res = await Roles.Update(data);
        const info = res.data.data;
        await store.Info(info);
    } catch (error) {
        console.log(error);
    }
}

export async function IsShow(data) {
    try {
        await Roles.IsShow(data);
    } catch (error) {
        console.log(error);
    }
}

export async function SoftDel(data) {
    try {
        await Roles.SoftDel(data);
    } catch (error) {
        console.log(error);
    }
}

export async function Del(data) {
    try {
        await Roles.Delete(data);
    } catch (error) {
        console.log(error);
    }
}